

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    
    <title>The resizePolicy module &mdash; pyamp v1.2 documentation</title>
    <link rel="stylesheet" href="../_static/default.css" type="text/css" />
    <link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
    <script type="text/javascript">
      var DOCUMENTATION_OPTIONS = {
        URL_ROOT:    '../',
        VERSION:     '1.2',
        COLLAPSE_INDEX: false,
        FILE_SUFFIX: '.html',
        HAS_SOURCE:  true
      };
    </script>
    <script type="text/javascript" src="../_static/jquery.js"></script>
    <script type="text/javascript" src="../_static/underscore.js"></script>
    <script type="text/javascript" src="../_static/doctools.js"></script>
    <link rel="top" title="pyamp v1.2 documentation" href="../index.html" />
    <link rel="up" title="The qt module" href="mod_pyamp_ui_qt.html" />
    <link rel="next" title="The spacers module" href="pyamp_ui_qt_spacers.html" />
    <link rel="prev" title="The keyEvents module" href="pyamp_ui_qt_keyEvents.html" /> 
  </head>
  <body>
    <div class="related">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../genindex.html" title="General Index"
             accesskey="I">index</a></li>
        <li class="right" >
          <a href="../py-modindex.html" title="Python Module Index"
             >modules</a> |</li>
        <li class="right" >
          <a href="pyamp_ui_qt_spacers.html" title="The spacers module"
             accesskey="N">next</a> |</li>
        <li class="right" >
          <a href="pyamp_ui_qt_keyEvents.html" title="The keyEvents module"
             accesskey="P">previous</a> |</li>
        <li><a href="../index.html">pyamp v1.2 documentation</a> &raquo;</li>
          <li><a href="mod_pyamp.html" >The pyamp module</a> &raquo;</li>
          <li><a href="mod_pyamp_ui.html" >The ui module</a> &raquo;</li>
          <li><a href="mod_pyamp_ui_qt.html" accesskey="U">The qt module</a> &raquo;</li> 
      </ul>
    </div>  

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body">
            
  <div class="section" id="module-pyamp.ui.qt.resizePolicy">
<span id="the-resizepolicy-module"></span><h1>The resizePolicy module<a class="headerlink" href="#module-pyamp.ui.qt.resizePolicy" title="Permalink to this headline">¶</a></h1>
<p>The resizePolicy module contains the ResizePolicy class which encapsulates
a specific policy for resizing widgets.</p>
<div class="section" id="the-resizepolicy-class">
<h2>The ResizePolicy class<a class="headerlink" href="#the-resizepolicy-class" title="Permalink to this headline">¶</a></h2>
<p class="graphviz">
<img src="../_images/inheritance-14e65d21ec23fcfeca7ce8206fd3292799744dea.png" alt="Inheritance diagram of pyamp.ui.qt.resizePolicy.ResizePolicy" usemap="#inheritance88a4d6945f" class="inheritance"/>
<map id="inheritance88a4d6945f" name="inheritance88a4d6945f">
<area shape="rect" href="#pyamp.ui.qt.resizePolicy.ResizePolicy" title="pyamp.ui.qt.resizePolicy.ResizePolicy" alt="" coords="5,7,259,33"/>
</map>
</p>
<dl class="class">
<dt id="pyamp.ui.qt.resizePolicy.ResizePolicy">
<em class="property">class </em><tt class="descclassname">pyamp.ui.qt.resizePolicy.</tt><tt class="descname">ResizePolicy</tt><a class="reference internal" href="../_modules/pyamp/ui/qt/resizePolicy.html#ResizePolicy"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyamp.ui.qt.resizePolicy.ResizePolicy" title="Permalink to this definition">¶</a></dt>
<dd><p>The ResizePolicy encapsulates a specific policy for resizing widgets.</p>
<p>The possible resize policies are:</p>
<blockquote>
<ul class="simple">
<li><strong>Fixed</strong> &#8211; The size never changes</li>
<li><strong>Expanding</strong> &#8211; The size expands</li>
</ul>
</blockquote>
<p>For a specific policy, the ResizePolicy class can return the correct size
for a widget, given the widget&#8217;s current size as well as the size of all
of the widget&#8217;s child widgets.</p>
<p>For the <em>Fixed</em> resize policy: the size will always remain the same.</p>
<p>For the <em>Expanding</em> resize policy: the size will always expand to fit all
of the widget&#8217;s children.</p>
<p>Example:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="kn">from</span> <span class="nn">PyQt4</span> <span class="kn">import</span> <span class="n">QtCore</span>
<span class="kn">from</span> <span class="nn">pyamp.ui.qt</span> <span class="kn">import</span> <span class="n">ResizePolicy</span>

<span class="c"># Create the size of the widget, and the list of sizes for all of</span>
<span class="c"># the widget&#39;s children</span>
<span class="n">size</span> <span class="o">=</span> <span class="n">QtCore</span><span class="o">.</span><span class="n">QSize</span><span class="p">(</span><span class="mi">100</span><span class="p">,</span> <span class="mi">200</span><span class="p">)</span>
<span class="n">childSizes</span> <span class="o">=</span> <span class="p">[</span><span class="n">QtCore</span><span class="o">.</span><span class="n">QSize</span><span class="p">(</span><span class="mi">200</span><span class="p">,</span> <span class="mi">500</span><span class="p">),</span> <span class="n">QtCore</span><span class="o">.</span><span class="n">QSize</span><span class="p">(</span><span class="mi">300</span><span class="p">,</span> <span class="mi">400</span><span class="p">)]</span>

<span class="c"># Get the list of widths and heights for the child widgets</span>
<span class="n">childWidths</span> <span class="o">=</span> <span class="nb">map</span><span class="p">(</span><span class="n">QtCore</span><span class="o">.</span><span class="n">QSize</span><span class="o">.</span><span class="n">width</span><span class="p">,</span> <span class="n">childSizes</span><span class="p">)</span>
<span class="n">childHeights</span> <span class="o">=</span> <span class="nb">map</span><span class="p">(</span><span class="n">QtCore</span><span class="o">.</span><span class="n">QSize</span><span class="o">.</span><span class="n">width</span><span class="p">,</span> <span class="n">childSizes</span><span class="p">)</span>

<span class="c"># Both of these return: 100</span>
<span class="c"># Which is the given value of width</span>
<span class="n">ResizePolicy</span><span class="o">.</span><span class="n">getSize</span><span class="p">(</span><span class="n">ResizePolicy</span><span class="o">.</span><span class="n">Fixed</span><span class="p">,</span> <span class="n">size</span><span class="o">.</span><span class="n">width</span><span class="p">(),</span> <span class="n">childWidths</span><span class="p">)</span>
<span class="n">ResizePolicy</span><span class="o">.</span><span class="n">getWidth</span><span class="p">(</span><span class="n">ResizePolicy</span><span class="o">.</span><span class="n">Fixed</span><span class="p">,</span> <span class="n">size</span><span class="p">,</span> <span class="n">childSizes</span><span class="p">)</span>

<span class="c"># Both of these return: 900</span>
<span class="c"># Which is the sum of the childHeights list</span>
<span class="n">ResizePolicy</span><span class="o">.</span><span class="n">getSize</span><span class="p">(</span><span class="n">ResizePolicy</span><span class="o">.</span><span class="n">Expanding</span><span class="p">,</span> <span class="n">size</span><span class="o">.</span><span class="n">height</span><span class="p">(),</span>
                     <span class="n">childHeights</span><span class="p">)</span>
<span class="n">ResizePolicy</span><span class="o">.</span><span class="n">getHeight</span><span class="p">(</span><span class="n">ResizePolicy</span><span class="o">.</span><span class="n">Fixed</span><span class="p">,</span> <span class="n">size</span><span class="p">,</span> <span class="n">childSizes</span><span class="p">)</span>
</pre></div>
</div>
<dl class="classmethod">
<dt id="pyamp.ui.qt.resizePolicy.ResizePolicy.getHeight">
<em class="property">classmethod </em><tt class="descname">getHeight</tt><big>(</big><em>policy</em>, <em>size</em>, <em>sizeList</em><big>)</big><a class="reference internal" href="../_modules/pyamp/ui/qt/resizePolicy.html#ResizePolicy.getHeight"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyamp.ui.qt.resizePolicy.ResizePolicy.getHeight" title="Permalink to this definition">¶</a></dt>
<dd><p>For the given resize policy, get the correct height for the size of
the widget as well as the size of all of the widget&#8217;s children.</p>
<ul class="simple">
<li>resizePolicy &#8211; The resize policy</li>
<li>size &#8211; The main <tt class="xref py py-class docutils literal"><span class="pre">PyQt4.QtCore.QSize</span></tt> of the widget</li>
<li>sizeList &#8211; The list of <tt class="xref py py-class docutils literal"><span class="pre">PyQt4.QtCore.QSize</span></tt> for sub widgets</li>
</ul>
</dd></dl>

<dl class="classmethod">
<dt id="pyamp.ui.qt.resizePolicy.ResizePolicy.getSize">
<em class="property">classmethod </em><tt class="descname">getSize</tt><big>(</big><em>policy</em>, <em>size</em>, <em>sizeList</em><big>)</big><a class="reference internal" href="../_modules/pyamp/ui/qt/resizePolicy.html#ResizePolicy.getSize"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyamp.ui.qt.resizePolicy.ResizePolicy.getSize" title="Permalink to this definition">¶</a></dt>
<dd><p>Get the correct size based on the given resize policy.</p>
<ul>
<li><p class="first">resizePolicy &#8211; The resize policy</p>
</li>
<li><p class="first">size &#8211; The main single size (width or height) of the widget</p>
</li>
<li><dl class="first docutils">
<dt>sizeList &#8211; The list of the single dimension size (widths or heights)</dt>
<dd><p class="first last">of widgets&#8217;s children</p>
</dd>
</dl>
</li>
</ul>
</dd></dl>

<dl class="classmethod">
<dt id="pyamp.ui.qt.resizePolicy.ResizePolicy.getWidth">
<em class="property">classmethod </em><tt class="descname">getWidth</tt><big>(</big><em>policy</em>, <em>size</em>, <em>sizeList</em><big>)</big><a class="reference internal" href="../_modules/pyamp/ui/qt/resizePolicy.html#ResizePolicy.getWidth"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyamp.ui.qt.resizePolicy.ResizePolicy.getWidth" title="Permalink to this definition">¶</a></dt>
<dd><p>For the given resize policy, get the correct width for the size of
the widget as well as the size of all of the widget&#8217;s children.</p>
<ul class="simple">
<li>resizePolicy &#8211; The resize policy</li>
<li>size &#8211; The main <tt class="xref py py-class docutils literal"><span class="pre">PyQt4.QtCore.QSize</span></tt> of the widget</li>
<li>sizeList &#8211; The list of <tt class="xref py py-class docutils literal"><span class="pre">PyQt4.QtCore.QSize</span></tt> for sub widgets</li>
</ul>
</dd></dl>

</dd></dl>

</div>
</div>


          </div>
        </div>
      </div>
      <div class="sphinxsidebar">
        <div class="sphinxsidebarwrapper">
  <h3><a href="../index.html">Table Of Contents</a></h3>
  <ul>
<li><a class="reference internal" href="#">The resizePolicy module</a><ul>
<li><a class="reference internal" href="#the-resizepolicy-class">The ResizePolicy class</a></li>
</ul>
</li>
</ul>

  <h4>Previous topic</h4>
  <p class="topless"><a href="pyamp_ui_qt_keyEvents.html"
                        title="previous chapter">The keyEvents module</a></p>
  <h4>Next topic</h4>
  <p class="topless"><a href="pyamp_ui_qt_spacers.html"
                        title="next chapter">The spacers module</a></p>
  <h3>This Page</h3>
  <ul class="this-page-menu">
    <li><a href="../_sources/_generated/pyamp_ui_qt_resizePolicy.txt"
           rel="nofollow">Show Source</a></li>
  </ul>
<div id="searchbox" style="display: none">
  <h3>Quick search</h3>
    <form class="search" action="../search.html" method="get">
      <input type="text" name="q" size="18" />
      <input type="submit" value="Go" />
      <input type="hidden" name="check_keywords" value="yes" />
      <input type="hidden" name="area" value="default" />
    </form>
    <p class="searchtip" style="font-size: 90%">
    Enter search terms or a module, class or function name.
    </p>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
        </div>
      </div>
      <div class="clearer"></div>
    </div>
    <div class="related">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../genindex.html" title="General Index"
             >index</a></li>
        <li class="right" >
          <a href="../py-modindex.html" title="Python Module Index"
             >modules</a> |</li>
        <li class="right" >
          <a href="pyamp_ui_qt_spacers.html" title="The spacers module"
             >next</a> |</li>
        <li class="right" >
          <a href="pyamp_ui_qt_keyEvents.html" title="The keyEvents module"
             >previous</a> |</li>
        <li><a href="../index.html">pyamp v1.2 documentation</a> &raquo;</li>
          <li><a href="mod_pyamp.html" >The pyamp module</a> &raquo;</li>
          <li><a href="mod_pyamp_ui.html" >The ui module</a> &raquo;</li>
          <li><a href="mod_pyamp_ui_qt.html" >The qt module</a> &raquo;</li> 
      </ul>
    </div>
    <div class="footer">
        &copy; Copyright 2012, Brett Ponsler.
      Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.0.1.
    </div>
  </body>
</html>